Codeshare List of user-contributed code snippets for dotCMS Java CMS.

Author: "Michael Fienen"

Dynamic File Cachebuster Variables

Author: Michael Fienen |

There are times where you might want to add a dynamic variable to the end of a file to help browsers repull the file after changes have been made to it...

Conditionalized Structure Fields

Author: Michael Fienen |

This javascript code can be used in a custom field as an example of making fields visible conditionally based on the value of another field.

Getting the page context values

Author: Michael Fienen |

This will echo out all the Velocity variables set in the given page's context.

Flexible Navigation Macro

Author: Michael Fienen |

This macro is designed to wrap the stock navigation() macro such that it will default to the current location depth, with a default depth, both of which...

Phone Number Formatting Macro

Author: Michael Fienen |

If you have ever had multiple people entering phone numbers into a field, you have no doubt discovered the varied formats they can provide.

Lucene Syntax to Respect Publish and Expire Dates

Author: Michael Fienen |

If you are trying to do something, for instance with news items, that need to respect both a publish and expire date, you just need some simple Lucene ...

Minimal Starter Site

Author: Michael Fienen |

In the event that you want to install dotCMS with the minimal amount of content necessary you can download this starter.zip file and replace the one included...

Strip HTML tags from WYSIWYG Field Output

Author: Michael Fienen |

Very simple method for cases where you need to get rid of the HTML tags in a contentlet field, like auto-generating a content summary when a manual summary...

Set Cookies Via Header Requests

Author: Michael Fienen |

In cases where you have a known condition that you want to save as a cookie to the users browser, have they been here before , what was the last page they...

URLMapContent Failsafe

Author: Michael Fienen |

Include this code at the top of your template or in your init container so that in cases where a detail page is being hit outside of a URL Map Pattern,...